import { Behaviour, HitTestScript, getGameObjectById, GameObject, core } from "../gameengine";
import { ColliderSystem } from "../rect/ColliderSystem";
import { RectCollider, RectColliderType } from "../rect/RectCollider";
import { marshal, MarshalFinishState } from "../Marshal";

export class nainiu extends Behaviour {

    protected onStart() {

            

    }

    protected onUpdate(advancedTime: number) {

        const colliderSystem = getGameObjectById("Scene").getScript(ColliderSystem);
            const collider = this.displayObject.getScript(RectCollider);
            const nextCollider = {
                left: collider.left + -4,
                right: collider.right + 4,
                top: collider.top + -4,
                bottom: collider.bottom + 4
            }
            const hitTestResult1 = colliderSystem.check(nextCollider, RectColliderType.MAINROLE);

            if (hitTestResult1){
                marshal.changeState(new MarshalFinishState());
                

                
            }

    }



}